package org.smartit.client.config.menu;

import com.google.gwt.i18n.client.Dictionary;

import java.util.MissingResourceException;

/**
 * Date: 01/10/13
 * Time: 20:20
 */
public enum SubMenuItemEnum {

    CreateClient(true, "create_client", "create_client_explanation"),
    SearchClients(false, "search_clients", "search_clients_explanation"),
    ImportClients(true, "import_clients", "import_clients_explanation"),

    CreateService(true,"create_service", "create_service_explanation"),
    SearchServices(false, "search_services", "search_services_explanation"),

    MakeSale(true,"make_sale", "make_sale_explanation"),
    SearchSales(false, "search_sales", "search_sales_explanation"),

    MakePayment(true,"make_payment", "make_payment_explanation"),
    SearchPayments(false, "search_payments", "search_payments_explanation"),
    ImportPayments(true, "import_payments", "import_payments_explanation"),

    CreateReport(true,"create_report", "create_report_explanation"),
    SearchReports(false, "search_reports", "search_reports_explanation"),

    CreateCommunication(true,"create_communication", "create_communication_explanation"),
    SearchCommunications(false, "search_communications", "search_communications_explanation"),

    CreateDocument(true,"create_document", "create_document_explanation"),
    SearchDocuments(false, "search_documents", "search_documents_explanation");

    boolean popup;
    String labelKey;
    String explanationLabelKey;

    private SubMenuItemEnum(boolean popup, String labelKey, String explanationLabelKey) {
        this.popup = popup;
        this.labelKey = labelKey;
        this.explanationLabelKey = explanationLabelKey;
    }

    public boolean isPopup() {
        return popup;
    }

    public String getLabel() {
        Dictionary messages = Dictionary.getDictionary("messages");
        try {
            return messages.get(labelKey);
        } catch (MissingResourceException e) {
            return labelKey;
        }
    }

    public String getExplanationLabel() {
        Dictionary messages = Dictionary.getDictionary("messages");
        try {
            return messages.get(explanationLabelKey);
        } catch (MissingResourceException e) {
            return explanationLabelKey;
        }
    }
}
